#include<stdio.h>
#include<iostream>
#include<string.h>
using namespace std;
int flag[4000000 + 5] = { 0 };
int main()
{
	int n, num, i, mode = 0, index = 0;
	cin >> n;
	while (n--)
	{
		cin >> num;
		if (num >= 0)flag[num + 2000000]++;
		else flag[-num]++;
	}
	for (i = 4000000; i >= 0; i--)
	{
		if (flag[i] > mode)
		{
			index = i;
			mode = flag[i];
		}
	}
	if (index >= 2000000)cout << index - 2000000 << endl;
	else cout << -index << endl;
	return 0;
}